package com.agmte.api.app.entity;


import com.agmte.api.app.entity.pojo.ApiMapper;
import com.agmte.api.common.crud.annotation.FieldAnno;
import com.agmte.api.common.crud.annotation.FieldId;
import com.agmte.api.common.crud.annotation.TableAnno;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;

@Data
@TableAnno(value = "api_info", describe = "分组")
public class ApiInfo {

    @FieldId
    private Long id;

    @FieldAnno(value = "name", desc = "接口名称")
    @ApiModelProperty("接口名称")
    @NotBlank(message = "接口名称不能为空")
    private String name;


    @FieldAnno(value = "path", desc = "接口path")
    @ApiModelProperty("接口path")
    @NotBlank(message = "接口路径不能为空")
    private String path;

    @FieldAnno(value = "type", desc = "类别")
    @ApiModelProperty("类别")
    private String type;


    @FieldAnno(value = "gid", desc = "分组Id")
    @ApiModelProperty("分组Id")
    private Long gid;

    @ApiModelProperty("分组名称")
    private String gidName;


    @FieldAnno(value = "mappers", desc = "mapper定义", typeHandler = ApiMapper.class)
    @ApiModelProperty("mapper定义")
    @NotEmpty(message = "必定mapper定义")
    @Valid
    private List<ApiMapper> mappers;
}
